// #include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h> // for EXIT_FAILURE

int main()
{

FILE* thisfile;
thisfile = fopen("stuff.txt", "r");
FILE* outfile;
outfile = fopen("census.txt", "w");

char temp = 'a';
char print = 'a';

fprintf(outfile,"Key\tValue\n");
while(temp!='+'){;
	while((temp = fgetc(thisfile)) != '\"');
	while((temp = fgetc(thisfile)) != '('){
		if((temp>='a'&&temp<='z') || (temp>='A' && temp<='Z'))
			fputc(temp, outfile);
	}
	fputc(' ',outfile);
	while((temp = fgetc(thisfile)) != 'F');
	temp = fgetc(thisfile);
	while((temp = fgetc(thisfile)) != ','){
		fputc(temp, outfile);
	}
	fputc('\n',outfile);
	while((temp = fgetc(thisfile)) != '\n'){
	}
	temp=fgetc(thisfile);
}

fclose(thisfile);
fclose(outfile);

return 0;
}
